package com.day.mapper;

import com.day.pojo.School;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface SchoolMapper {
    @Select("select * from school")
    List<School> getSchoolList();

    @Select("select * from school where s_id = #{s_id};")
    School getSchoolById(Integer s_id);

    @Insert("insert into school values (0,#{s_name},#{s_address});")
    void addSchool(School school);

    @Delete("delete from school where s_id = #{s_id};")
    void delSchoolById(Integer s_id);

    @Update("update school set s_name = #{s_name},s_address = #{s_address} where s_id = #{s_id};")
    void editSchoolById(School school);
}
